
      Zombies = { }
	  spawnPoints = {}   

      local zombieinit = false
	 
       

     function func()

              zombieinit = true  
			  
				print("Zombies init")

      end  

        

      local NextZombieSpawn = CurTime( ) + math.random( 5 )



		timer.Create( "my_timer", 10, 0, function()
	// Timer code here
 print("Timer tick")

              if zombieinit then -- Have we set up the map yet?
			   print("Are we cycling?")

                      if CurTime( ) >= NextZombieSpawn then  
					  			   print("curtime is greater then" .. NextZombieSpawn)

								spawns = 1	
                              for k, v in pairs( ents.GetAll( ) ) do -- Loops through all entities

                                               if v:GetClass( ) == "info_player_start" then -- Is it info_zspawn?
											   			   print("Found an info_player_start")
                                                     
													  table.insert(spawnPoints, v)  
                                              end
											  
                              end
													  
								if ( table.Count(spawnPoints) > 0 ) then
										WhichSpawn = math.random(1, table.Count(spawnPoints))    --picks a random spawn
											else
												print("No spawn points found!")
													end
												
															
								print("Set which spawn to" .. WhichSpawn)
                              for k, v in pairs(spawnPoints) do -- Loops through all spawnpoints
 
                                      if k == WhichSpawn then                          -- Is it info_zspawn we want to spawn at?
									  	print("Is it info_player_start we want to spawn at? (" .. WhichSpawn .. ")")
									  
 
                                              local zombie = ents.Create( "npc_zombie" ) -- Create our zombie
												print("Create a zombie ")

                                              zombie:SetPos( v:GetPos( ) + Vector( 0, 0, 10 ) ) -- Set our zombies position and make it spawn slightly above the info_zspawn entity
											--	print("Set zombies spawn pos to " .. V:GetPos)
                                              zombie:Spawn( ) -- Spawn our zombie  
											 -- print("Spawned zombie at" .. zombie:GetPos( ))

       

                                              NextZombieSpawn = CurTime( ) + math.random(  )
												--print("Set our next cur time to" .. NextZombieSpawn)

                                      end

                              end

                      end

              end

      end )
